package ca.llsutherland.nfl.domain;

import java.io.Serializable;

public class DomainObject implements Serializable, Comparable<DomainObject> {
	
	private static final long serialVersionUID = 1L;

	private Long id;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public int compare(Object o1, Object o2) {
		DomainObject do1 = (DomainObject)o1;
		DomainObject do2 = (DomainObject)o2;
		return do1.getId().compareTo(do2.getId());
	}
	
	
	@Override
	public int hashCode() {
		return this.getId().hashCode();
	}
	
	public boolean equals(DomainObject obj) {
		DomainObject dobj = obj;
		return this.id.equals(dobj.getId());
	}

	public int compareTo(DomainObject o) {
		DomainObject do1 = o;
		return do1.compare(this, do1);
	}
}
